#!/usr/bin/perl -w
use strict;
use Getopt::Long;
my @files = qw(CJB4 CJB5-2 CJB7 JEL289 JEL627  
	       SRS812 TST75 JAM81 JEL423);
my @genomes = qw(JEL423 JAM81);
my $basedir = '/srv/projects/stajichlab/projects/bd_popgen/analysis';

GetOptions(
	'd|dir:s' => \$basedir);

for my $file ( @files ) {
    for my $genome ( @genomes ) {
	open(OUT, ">remapSNP_$file.$genome.sh");
	print OUT "#!/bin/bash\n";
	print OUT "GENOME=$genome\n";
	print OUT "STRAIN=$file\n";
	print OUT "cd $basedir\n";
	print OUT "samtools pileup -c -l \$GENOME.SNPs.dat -f \$GENOME.fa \$STRAIN.\$GENOME.bam > \$STRAIN.\$GENOME.pileup_all 2>/dev/null\n";
    }
}
